﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoursePack;
using System.Text.RegularExpressions;

namespace CoursePack
{
    
    [Serializable]
    public class Student
    {
        private string m_FirstName;
        private string m_LastName;
        private string m_NetName;
        private string m_Password;

        private Degree m_Degree;
        private Semester m_CurrentSemester;


        public Student(string _Fn, string _Ln, string _Nn,string _Npass,Department _Department, EnumDegree _degree)
        {
            m_FirstName = _Fn;
            m_LastName = _Ln;
            m_NetName = _Nn;
            m_Password = _Npass;


            this.m_Degree = new Degree(_Department, _degree);
            this.m_CurrentSemester = null;
            
        }


        public void AddCompleteddCourse(CourseDescription _Course)
        {
            this.m_Degree.AddCompletedCourse(_Course);
        }
        /*
        public void AddSchedule(StudentSchedule _Schedule,Session _Session)
        {
            if (_Session.ESession == this.m_CurrentSemester.Session && _Session.Year == this.m_CurrentSemester.Year)
                this.m_CurrentSemester.Schedule = _Schedule;
            else
            {
                this.m_Degree.GetSemester(_Session).Schedule = _Schedule;
            }
        }*/

        public bool IsValidPassword(string _pass)
        {
            return (_pass == this.m_Password) ? true : false;
        }

        public bool IsCoursePrerequisitesDone(Course _Course)
        {
            foreach (Prerequisite pre in _Course.Prerequistes)
            {
                if (!pre.IsPrerequisteCompleted(this.Degree.CoursesDone))
                    return false;
            }
            return true;
        }

        #region Accessors

        public string NetName
        {
            get { return this.m_NetName; }
        }

        public override string ToString()
        {
            return this.m_FirstName + " " + this.m_LastName;
        }

        public Degree Degree
        {
            get { return this.m_Degree; }
        }

        #endregion

    }
}